window.onload = function() {
	$.get("http://47.104.244.134:8080/goodstypelist.do", {
		l: 2
	}).done(data => {
		// console.log(data);
	})
	
	
	$.get("http://47.104.244.134:8080/goodsbytid.do", {
		tid: 13,
		page: 1,
		limit: 30
	}).done(data => {
		// console.log(data);
		if (data.code == 200) {
			console.log(data.data);
			let pArray = data.data
			let html = ''
			let html1 = ''
			let html2 = ''
			let html8 =''
			for (let i = 1; i < 5; i++) {
				let pObj = pArray[i]
				// console.log(pObj)
				html +=
					`
								<div id="delez${i}">
									<a href='detail.html?id=${pObj.id}'><img src='${pObj.picurl}'>
										<h5>'${pObj.info}'</h5>
										<p>'${pObj.name}'</p>
									</a>
								</div>
							`
			}
			$('#dellb2').html(html)
			
			for (let i = 6; i < 10; i++) {
				let pObj = pArray[i]
				// console.log(pObj)
				html1 +=
					`
					<div id="shouji${i}">
						<a href='detail.html?id=${pObj.id}'><img src='${pObj.picurl}'>
							<h5>'${pObj.info}'</h5>
							<p>'${pObj.name}'</p>
						</a>
					</div>
							`
			}
			$('#shouj').html(html1)
			
			// console.log(pArray[11].picurl)
			html2 = `<a href='detail.html?id=${pArray[11].id}'><img src="${pArray[11].picurl}"></a>`
			$('#znxf2').html(html2)
			
			
			let html3 = `<a href='detail.html?id=${pArray[12].id}'><img src="${pArray[12].picurl}"></a>
			<div id="fxsj2"></div>`
			$('#fxsj').html(html3)
			
			
			
			let html4 = `<a href='detail.html?id=${pArray[11].id}'><img src="${pArray[11].picurl}">
			<p>${pArray[11].name}</p>

			
			</a>`
			$('#tish').html(html4)
			
			
			let html5 = `
					<a href='detail.html?id=${pArray[12].id}'><img src="${pArray[12].picurl}">
					<p>${pArray[12].name}</p>
					</a>
					
					
			`
			$('#tssh').html(html5)
			
			let html6 = `
					
					
					<a href='detail.html?id=${pArray[4].id}'>
					<img src='${pArray[4].picurl}'></a>
					<a href='detail.html?id=${pArray[2].id}'><img src='${pArray[2].picurl}'></a>
					<div id="pzsj2"></div>
					
			`
			$('#pzsj').html(html6)
			
			
			let html7 = `
			<div id="jieshu2">
				<a href='detail.html?id=${pArray[3].id}'><img src='${pArray[3].picurl}'></a>
			</div>
			<div id="jieshu3">
				<a href='detail.html?id=${pArray[1].id}'>
				<img src='${pArray[1].picurl}'>
				<img src='${pArray[1].picurl}'></a>
			</div>
			
			`
			$('#jieshu').html(html7)
			
			
			
			for (let i = 2; i < 6; i++) {
				let pObj = pArray[i]
				// console.log(pObj)
				html8 +=
					`
								<div id="naifen${i}">
									<a href='detail.html?id=${pObj.id}'><img src='${pObj.picurl}'>
										<h5>'${pObj.info}'</h5>
										<p>'${pObj.name}'</p>
									</a>
								</div>
							`
			}
			$('#naifen').html(html)
			
			
		}
	})
	
		
	
}





// 	$.get("http://47.104.244.134:8080/goodsbytid.do", {
// 		tid: 13,
// 		page: 1,
// 		limit: 5
// 	}).done(data => {
// 		// console.log(data);
// 		if (data.code == 200) {
// 			// console.log(data.data);
// 			let pArray = data.data
// 			let html = ''
			// for (let i = 1; i < pArray.length; i++) {
			// 	let pObj = pArray[i]
			// 	// console.log(pObj)
			// 	html +=
			// 		`
			// 					<div id="naifen${i+1-1}">
			// 						<a href='detail.html?id=${pObj.id}'><img src='${pObj.picurl}'>
			// 							<h5>'${pObj.info}'</h5>
			// 							<p>'${pObj.name}'</p>
			// 						</a>
			// 					</div>
			// 				`
			// }
			// $('#naifen').html(html)
// 		}


